import request from '@/utils/request'

// 查询机构数据字典列表 (分页)
export function selectPageSysOrgDict(query: any) {
    return request({
        url: '/system/sysOrgDict/selectPage',
        method: 'get',
        params: query
    })
}

// 查询机构数据字典列表 (不分页)
export function listSysOrgDict(query: any) {
    return request({
        url: '/system/sysOrgDict/list',
        method: 'get',
        params: query
    })
}

// 查询机构数据字典列表和公共字典合并
export function listSysOrgDictShow(query: any) {
    return request({
        url: '/system/sysOrgDict/listSysOrgDictShow',
        method: 'get',
        params: query
    })
}

// 查询机构数据字典详细
export function getSysOrgDict(orgDictId: string) {
    return request({
        url: '/system/sysOrgDict/' + orgDictId,
        method: 'get'
    })
}

// 新增机构数据字典
export function addSysOrgDict(data: any) {
    return request({
        url: '/system/sysOrgDict',
        method: 'post',
        data: data
    })
}

// 修改机构数据字典
export function updateSysOrgDict(data: any) {
    return request({
        url: '/system/sysOrgDict',
        method: 'put',
        data: data
    })
}

// 删除机构数据字典
export function delSysOrgDict(orgDictId: string) {
    return request({
        url: '/system/sysOrgDict/' + orgDictId,
        method: 'delete'
    })
}


// 通过字典勾选批量增加
export function saveBatchOrgDictInData(data: any) {
    return request({
        url: '/system/sysOrgDict/saveBatchOrgDictInData',
        method: 'post',
        data: data
    })
}

// 添加对照
export function updateSysOrgDictToClinic(data: any) {
    return request({
        url: '/system/sysOrgDict/updateSysOrgDictToClinic',
        method: 'post',
        data: data
    })
}

// 查询系统平台字典列表(业务字典中不存在数据)
export function listNotExistBaseData (query) {
  return request({
    url: '/system/sysOrgDict/listNotExistBaseData',
    method: 'get',
    params: query
  })
}

// 刷新机构字典缓存
export function refreshCache(orgId) {
  return request({
    url: "/system/sysOrgDict/refreshCache/" + orgId,
    method: "delete",
  });
}
